package com.zyg.consumer;

import sun.rmi.log.LogInputStream;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

public class MyConsumerDemo {
    public static void main(String[] args) {
        List<String> sources = new ArrayList<>();
        sources.add("张三");
        sources.add("李四");
        sources.add("王五");
        sources.add("赵六");
       // consum1(sources,v-> System.out.println(v));
        consum2(sources,v-> System.out.println(v),v-> System.out.println(v));

    }

    public static void consum1(List<String> source, Consumer<String> consumer) {
        source.forEach(v -> consumer.accept(v));
    }

    public static void consum2(List<String> source, Consumer<String> consumer1,Consumer<String> consumer2) {
        source.forEach(v -> consumer1.andThen(consumer2).accept(v));
    }
}
